﻿@model IEnumerable<PessModel.Author>

@{
    ViewBag.Title = "作者（用户）列表";
}

<h2>Index</h2>
<h3 style="color:red">@ViewBag.ErrorMessage</h3>
<p>
    @Html.ActionLink("新作者（用户）", "Create")
</p>
@using (Html.BeginForm("ResetPassword", "Author",FormMethod.Post))
{
    <div id="ResetPassword">
        @Html.TextBox("Password", null, new { @class = "u-it", style = "width:150px;" })
        <input type="submit" value="重置密码" class="u-btn" />
    </div>
    <table>
        <tr>
            <th></th>
            <th>
                @Html.DisplayNameFor(model => model.UserID)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.RealName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Phone)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.ContactAddress)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.ZipCode)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.SerialNumber)
            </th>
            <th></th>
        </tr>
    @{int x = 0;}
    @foreach (var item in Model) {
        <tr>
            <td class="f-ck-mid">@Html.CheckBox("Authors[" + x + "].IsSelected")
                @Html.Hidden("Authors[" + x + "].SerialNumber", item.SerialNumber)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.UserID)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.RealName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Phone)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ContactAddress)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ZipCode)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.SerialNumber)
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit",new {authorSN=item.SerialNumber,returnUrl = HttpContext.Current.Request.RawUrl},null) |
                @Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
                @Html.ActionLink("Delete", "Delete", new { authorSN=item.SerialNumber })
            </td>
        </tr>
        { x = x + 1; }
    }

    </table>
}